<?php


   class YuantuAction extends Action{
   
     public function index(){
	 
	   $this->re=M('orderinfo')->where('id="%s"',$_GET['id'])->field('qingxi')->find();
	   
	   
	   
	   $this->display();
	 
	 }
	 public function getHtml(){
	 	  echo  base64_encode($this->fetch('Yuantu:base'));
	 }
   
   
     public function shipin(){
	 
	  // if($this->is_weixin()){

		//  $this->display('zhezhao');
		
		//}else{
		
		
	 
		   $user=M('dailiuser')->where('id="%s"',$_GET['uid'])->find();
		   
		 /*  if($user['weixinhao']==""  and $user['qqhao']==""){
			   $shangjikefu=M('dailiuser')->where('id="%s"',$user['fenxiaoid'])->find();
		       $this->weixinhao=$shangjikefu['weixinhao'];
		       $this->qqhao=$shangjikefu['qqhao'];
			}else{
			  $this->weixinhao=$user['weixinhao'];
		      $this->qqhao=$user['qqhao'];
		   }*/
		   
		   //判断字符串有没有超时
		   $end=time()-300;
		   $where['time']=array('gt',$end);
		   $where['str']=array('eq',$_GET['str']);
		   $ishave=M('suijizifu')->where($where)->find();
		   
		  // dump(M('suijizifu')->getlastsql());
		   
		 //  dump($ishave);die;
		   
		  if($ishave==null){
			 $sys=M('system')->where('id=1')->find();
			 $url=$sys['zhengguiwenzhang'];
			 Header("Location:$url");exit();
		   }
		   
		  
		  
		   $this->re=M('pianku')->where('id="%s"',$_GET['id'])->field('video,img,vtime,size')->find();
		   
		   $this->sys=M('system')->where('id=1')->find();
		   
		   
		   $yuming=M('yuming')->order('id desc')->limit('1')->find();
		   
		   $this->yuming=$yuming['yuming'];
		   $this->id=$_GET['uid'];
		   
		   $kefu=M('kefu')->select();
		   shuffle($kefu);
		   $this->kefu=$kefu[0]['kefu'];
		   
		   
		   $this->display();
	   
	   
	 //  }
	 
	 }
	 
	 
	    public function is_weixin(){ 

			if ( strpos($_SERVER['HTTP_USER_AGENT'], 
			
			'MicroMessenger') !== false ) {
			
					return true;
			
				}  
			
					return false;
			
			}
	 
	 
	 public function tiaozhuan(){
	 
	   $sys=M('system')->where('id=1')->find();
	   $url=$sys['url'];
	   
	   $this->pingguo=$url."/shipin.php?id=".$_GET['id'];
	   $this->anzhuo=$url."/index.php/yuantu/shipin/id/".$_GET['id'];
	    $this->display();
	 
	 }
   
   
   }